#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->pushButton_up->setShortcut(QKeySequence(Qt::Key_W));
       ui->pushButton_down->setShortcut(QKeySequence(Qt::Key_S));
          ui->pushButton_left->setShortcut(QKeySequence(Qt::Key_A));
             ui->pushButton_right->setShortcut(QKeySequence(Qt::Key_D));
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_up_clicked()
{
    QRect rect=ui->lineEdit->geometry();
    ui->lineEdit->setGeometry(rect.x(),rect.y()-10,rect.width(),rect.height());
}
void Widget::on_pushButton_down_clicked()
{
    QRect rect=ui->lineEdit->geometry();
    ui->lineEdit->setGeometry(rect.x(),rect.y()+10,rect.width(),rect.height());
}
void Widget::on_pushButton_left_clicked()
{
    QRect rect=ui->lineEdit->geometry();
    ui->lineEdit->setGeometry(rect.x()-10,rect.y(),rect.width(),rect.height());
}
void Widget::on_pushButton_right_clicked()
{
    QRect rect=ui->lineEdit->geometry();
    ui->lineEdit->setGeometry(rect.x()+10,rect.y(),rect.width(),rect.height());
}
